import java.util.ArrayList;
import java.util.Collections;

public class Test {
    public static void main(String[] args) {
        ArrayList<GameEquipment> list = new ArrayList<>(){{
                add(new GameEquipment(1,"石剑",5,100));
                add(new GameEquipment(2,"铁剑",10,1000));
                add(new GameEquipment(3,"钻石剑",20,5000));
        }};

        Collections.sort(list,new GameEquipmentAttackPowerComparator());
        System.out.println("升序排序");
        for (GameEquipment game:list){
            System.out.println("武器名称："+game.getName()+"   攻击力：" + game.getAttackPower());
        }
        System.out.println();

        Collections.reverse(list);
        System.out.println("逆序排序");
        for (GameEquipment game:list){
            System.out.println("武器名称："+game.getName()+"   攻击力：" + game.getAttackPower());
        }
        System.out.println();

        Collections.shuffle(list);
        System.out.println("随机排序");
        for (GameEquipment game:list){
            System.out.println("武器名称："+game.getName()+"   攻击力：" + game.getAttackPower());
        }
        System.out.println();

        GameEquipment attackPowerMax = Collections.max(list,new GameEquipmentAttackPowerComparator());
        System.out.println("武器攻击力最大值");
        System.out.println("武器名称："+attackPowerMax.getName()+"  攻击力："+attackPowerMax.getAttackPower());

    }

}
